<div class="section">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <table width="500">
                    <tr><th>分类名称</th><th>操作</th></tr>
                    <foreach name="category" item="v">
                        <tr><td>{:str_repeat('— ',$v['level'])}{$v.name}</td><td><a href="{:U('Category/edit',array('id'=>$v['id']))}">修改</a>　<a href="#" class="act-del" data-id="{$v.id}" >删除</a></td></tr>
                    </foreach>
                </table>
                </ul>
            </div>
        </div>
    </div>
</div>
<form method="post" id="form">
    <input type="hidden" name="id" id="target_id">
</form>
<script>
    //删除
    $(".act-del").click(function(){
        if(confirm('确定要删除吗？（该分类下的商品将归于未分类）')){
            $("#target_id").val($(this).attr("data-id"));
            $("#form").attr("action","{:U('Category/del')}").submit();
        }
    });
</script>